﻿/*include:js\declare*/
//默认密码输入框	<input defaultpassword="{PasswordId:'YYY'}" id="XXX" type="text" /><input id="YYY" type="text" />
(function(){
var DefaultPassword=function()
	{
	this.GetArgument(arguments[0],{Id:null,Event:null,PasswordId:null});
	this.Start(this.Event||{IsGetOnly:1});
	};
(fastCSharp.Functions.DefaultPassword=DefaultPassword).Inherit(fastCSharp.BaseFunction,{
Start:function(Event)
	{
	if(!Event.IsGetOnly)
		{
		var Element=fastCSharp.$Id(this.Id),Input=Element.Element(),Password=fastCSharp.$Id(this.PasswordId);
		if(Input!=this.Element)
			{
			this.Element=Input;
			Password.AddEvent('blur',fastCSharp.ThisFunction(this,this.OnBlur));
			}
		Element.Display(0);
		Password.Display(1).Focus();
		}
	},
OnBlur:function()
	{
	var Password=fastCSharp.$Id(this.PasswordId);
	if(!Password.Value())
		{
		Password.Display(0);
		fastCSharp.$Id(this.Id).Display(1);
		}
	}
		});
new fastCSharp.Declare('DefaultPassword','focus','Src');
})();